package com.zhiche.lisa.oms.dao.model;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableLogic;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.zhiche.lisa.oms.vo.LocationVo;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

/**
 * <p>
 * 订单货物明细
 * </p>
 *
 * @author qichao
 * @since 2018-08-29
 */
@TableName("lisa_order_item")
public class OrderItem extends Model<OrderItem> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
	@TableId(value="id", type= IdType.AUTO)
	private Long id;
    /**
     * 订单ID
     */
	@TableField("order_id")
	private Long orderId;
    /**
     * 数量
     */
	private Integer amount;
    /**
     * 度量单位
     */
	private String uom;
    /**
	 *  车架号
	 */
	@TableField("issue_item_id")
	private String issueItemId;
    /**
     * 当前状态
     */
	@TableField("current_status")
	private String currentStatus;
    /**
	 * 货主ID
	 */
	@TableField("owner_id")
	private Long ownerId;
	/**
	 * 货主名称
	 */
	@TableField("owner_name")
	private String ownerName;
	/**
	 * 创建时间
	 */
	@TableField("gmt_create")
	private Date gmtCreate;
	/**
	 * 租户ID
	 */
	@TableField("tenant_id")
	private Long tenantId;
	/**
	 * 所下订单中的原始货物类型
	 */
	private String material;

	@TableField("is_delete")
	@TableLogic
	private Integer isDelete;

	@TableField("item_source_key")
	private String itemSourceKey;
	/**
	 * 交货点(并含有行政编码)
	 */
	@TableField(exist = false)
	private LocationVo endLocation;
	/**
	 * 提货点(并含有行政编码)
	 */
	@TableField(exist = false)
	private LocationVo startLocation;

	public String getItemSourceKey() {
		return itemSourceKey;
	}

	public void setItemSourceKey(String itemSourceKey) {
		this.itemSourceKey = itemSourceKey;
	}

	public Integer getIsDelete() {
		return isDelete;
	}

	public void setIsDelete(Integer isDelete) {
		this.isDelete = isDelete;
	}


	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getOrderId() {
		return orderId;
	}

	public void setOrderId(Long orderId) {
		this.orderId = orderId;
	}

	public Integer getAmount() {
		return amount;
	}

	public void setAmount(Integer amount) {
		this.amount = amount;
	}

	public String getUom() {
		return uom;
	}

	public void setUom(String uom) {
		this.uom = uom;
	}

	public String getIssueItemId() {
		return issueItemId;
	}

	public void setIssueItemId(String issueItemId) {
		this.issueItemId = issueItemId;
	}

	public String getCurrentStatus() {
		return currentStatus;
	}

	public void setCurrentStatus(String currentStatus) {
		this.currentStatus = currentStatus;
	}

	public Long getOwnerId() {
		return ownerId;
	}

	public void setOwnerId(Long ownerId) {
		this.ownerId = ownerId;
	}

	public String getOwnerName() {
		return ownerName;
	}

	public void setOwnerName(String ownerName) {
		this.ownerName = ownerName;
	}

	public Date getGmtCreate() {
		return gmtCreate;
	}

	public void setGmtCreate(Date gmtCreate) {
		this.gmtCreate = gmtCreate;
	}

	public Long getTenantId() {
		return tenantId;
	}

	public void setTenantId(Long tenantId) {
		this.tenantId = tenantId;
	}

	public String getMaterial() {
		return material;
	}

	public void setMaterial(String material) {
		this.material = material;
	}

	@Override
	protected Serializable pkVal() {
		return this.id;
	}

	@Override
	public String toString() {
		return "OrderItem{" +
			", id=" + id +
			", orderId=" + orderId +
			", amount=" + amount +
			", uom=" + uom +
			", issueItemId=" + issueItemId +
			", currentStatus=" + currentStatus +
				", ownerId=" + ownerId +
				", ownerName=" + ownerName +
			", gmtCreate=" + gmtCreate +
				", tenantId=" + tenantId +
				", material=" + material +
			"}";
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;
		OrderItem orderItem = (OrderItem) o;
		return Objects.equals(issueItemId, orderItem.issueItemId) &&
				Objects.equals(itemSourceKey, orderItem.itemSourceKey);
	}

	@Override
	public int hashCode() {
		return Objects.hash(issueItemId, itemSourceKey);
	}

	public LocationVo getEndLocation() {
		return endLocation;
	}

	public void setEndLocation(LocationVo endLocation) {
		this.endLocation = endLocation;
	}

	public LocationVo getStartLocation() {
		return startLocation;
	}

	public void setStartLocation(LocationVo startLocation) {
		this.startLocation = startLocation;
	}
}
